home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / RTLib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-28  |  3.0 KB  |  149 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        RTLib.h
  3.  
  4.     Copyright:    © 1990-91,96 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    2.0
  8.     
  9.     For System 7.1 and up.
  10.  
  11.     Support Classic 68K and CFM-68K
  12. */
  13.  
  14. #ifndef __RTLib__
  15. #define __RTLib__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24.  
  25. #if GENERATINGPOWERPC
  26. #error "RTLib.h is only valid for 680x0 code."
  27. #endif
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. /*        Error Codes        */
  34.  
  35. enum { eRTNoErr=0, eRTBadVersion=2, eRTInvalidOp=4, eRTInvalidJTPtr=6
  36.     /* expect the following only if GENERATINGCFM && GENERATING68K */
  37.             ,kRT_not_segmented=8
  38.  
  39.         };
  40.  
  41.  
  42. /*        Action Codes        */
  43.  
  44. enum { kRTSysErr=0, kRTRetry=1, kRTContinue=2 };
  45.  
  46.  
  47. /*        Runtime Operations        */
  48.  
  49. enum    {    kRTGetVersion=10,        kRTGetVersionA5=11,
  50.              kRTGetJTAddress=12,    kRTGetJTAddressA5=13,
  51.              kRTSetPreLoad=14,        kRTSetPreLoadA5=15,
  52.              kRTSetSegLoadErr=16,    kRTSetSegLoadErrA5=17,
  53.              kRTSetPostLoad=18,    kRTSetPostLoadA5=19,
  54.              kRTSetPreUnload=20,    kRTSetPreUnloadA5=21,
  55.              kRTPreLaunch=22,        kRTPostLaunch=23,
  56.     /* use the following only if GENERATINGCFM && GENERATING68K */
  57.             kRTLoadSegbyNum=24,    kRTLoadSegbyNumA5=25
  58.         };
  59.  
  60.  
  61. /*        Version and Jump Table Entry Address Parameters        */
  62.  
  63. struct RTGetVersionParam {
  64.     unsigned short    fVersion;
  65. };
  66.  
  67. typedef struct RTGetVersionParam RTGetVersionParam;
  68.  
  69.  
  70. struct RTGetJTAddrParam {
  71.     void*    fJTAddr;
  72.     void*    fCodeAddr;
  73. };
  74.  
  75. typedef struct RTGetJTAddrParam RTGetJTAddrParam;
  76.  
  77.  
  78. /*        RTState Definition        */
  79.  
  80. struct RTState {
  81.     unsigned short    fVersion;                /* run-time version */
  82.     void*                fSP;                        /* SP: &-of user return address */
  83.     void*                fJTAddr;                    /* PC: &-of called jump table entry */
  84.     long                fRegisters[15];        /* registers D0-D7 and A0-A6 when */
  85.                                                     /*        _LoadSeg was called */
  86.     short                fSegNo;                    /*    segment number */
  87.     ResType            fSegType;                /*    segment type (normally 'CODE') */
  88.     long                fSegSize;                /*    segment size */
  89.     Boolean            fSegInCore;                /*    true if segment is in memory */
  90.     Boolean            fCallType;                /* 0= _LoadSeg call; 1 = Xvector call */
  91.     OSErr                fOSErr;                    /*    error number */
  92.     long                fReserved2;                /* (reserved for future use) */
  93. };
  94.  
  95. typedef struct RTState RTState;
  96.  
  97.  
  98. /*        Version Definitions        */
  99.  
  100. #define    kVersion32bit            0xFFFF        
  101. #define kVersionCFM68K            0xFFFD
  102. #define    kVersion16bit            0x0000                    
  103.  
  104.  
  105. /*        User Handler Definition        */
  106.  
  107. typedef pascal short (*SegLoadHdlrPtr) (RTState* state);
  108.  
  109.  
  110. /*        Segment Loader Hook Parameters        */
  111.  
  112. struct RTSetSegLoadParam {
  113.     SegLoadHdlrPtr    fUserHdlr;
  114.     SegLoadHdlrPtr    fOldUserHdlr;
  115. };
  116.  
  117. typedef struct RTSetSegLoadParam RTSetSegLoadParam;
  118.  
  119. struct RTLoadSegbyNumParam {
  120.     short fSegNumber;
  121. };
  122.  
  123. typedef struct RTLoadSegbyNumParam RTLoadSegbyNumParam;
  124.  
  125. /*        Runtime Parameter Block        */
  126.  
  127. struct RTPB {
  128.     short    fOperation;
  129.     void*    fA5;
  130.     union    {
  131.         RTGetVersionParam    fVersionParam;
  132.         RTGetJTAddrParam    fJTAddrParam;
  133.         RTSetSegLoadParam    fSegLoadParam;
  134.         RTLoadSegbyNumParam    fLoadbyNumParam;
  135.     } fRTParam;
  136. };
  137.  
  138. typedef struct RTPB RTPB;
  139.  
  140. pascal OSErr Runtime (RTPB* runtime_parms);
  141.  
  142.  
  143. #ifdef __cplusplus
  144. }
  145. #endif
  146.  
  147. #endif    /* __RTLib__ */
  148.  
  149.